<template>
  <tbody>
    <tr v-for="item in goodList" :key="item.name">
      <td>
        <input
          type="checkbox"
          v-model="item.checked"
          @click="$emit('click', item.name)"
        />
      </td>
      <td>{{ item.name }}</td>
      <td>{{ item.price }}</td>
      <td>
        <button @click="$emit('jianFn', item.name)">-</button>{{ item.num }}
        <button @click="$emit('jiaFn', item.name)">+</button>
      </td>
      <td>{{ item.price * item.num }}</td>
      <td><button @click="delItem(item.name)">删除</button></td>
    </tr>
  </tbody>
</template>

<script>
export default {
  props: {
    goodList: {
      type: Array,
      required: true,
    },
  },
  methods: {
    delItem(name) {
      this.$emit('delItem', name)
    },
  },
  computed: {},
}
</script>

<style></style>
